{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
{%include file="mail/mail.left.tpl.php"%}
        <!-- /.col -->
        <div class="col-md-9">
          <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">{%$type_name%} ( {%$count%} 封邮件)</h3>
			<form name="sfrom" method="get" action="">
              <div class="box-tools pull-right">
                <div class="has-feedback">
                  <input type="text" name="s" class="form-control input-sm" placeholder="搜 索">
				  <input type="hidden" name="a" value="mail.list">
                  <span class="glyphicon glyphicon-search form-control-feedback"></span>

                </div>
              </div>
			</form>
              <!-- /.box-tools -->
            </div>
            <!-- /.box-header -->
			{%if $type=="spambox"%}
			<form name="form2" action="index.php?a=mail.destoryall" method="post">
			{%else%}
			<form name="form2" action="index.php?a=mail.delall" method="post">
			{%/if%}
            <div class="box-body no-padding">
              <div class="mailbox-controls">
              </div>
              <div class="table-responsive mailbox-messages">
                <table class="table table-hover table-striped" id="mytable">
                  <thead>
                       <tr>
                            <td>选择</td>
							{%if $type=="outbox"%}
                            <td>收件人</td>
							{%else%}
                            <td>发件人</td>
							{%/if%}
                            <td>标题</td>
                            <td>时间</td>
                       </tr>
                  </thead>
                  <tbody>
				{%foreach from=$email_lists key=key item=value%}
                  <tr>
                    <td><input type="checkbox" name="pids[]" value="{%$value.mail_id%}"></td>
                    <td class="mailbox-name">{%$value.show_name%}</td>
                    <td class="mailbox-subject">
					{%if $value.is_read=='0'%}
					<a href="index.php?a=mail.info&mail_id={%$value.mail_id%}"><b>{%$value.mail_title%}</b></a>
					{%else%}
					<a href="index.php?a=mail.info&mail_id={%$value.mail_id%}">{%$value.mail_title%}</a>
					{%/if%}
                    </td>
                    <td class="mailbox-date">{%$value.create_time%}</td>
                  </tr>
				{%/foreach%}
                  </tbody>
                </table>
                <!-- /.table -->
              </div>
              <!-- /.mail-box-messages -->
            </div>
            <!-- /.box-body -->
            <div class="box-footer no-padding">
              <div class="mailbox-controls">
                <!-- Check all button -->
                <button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i>
                </button>
                <div class="btn-group">
					{%if $type=="spambox"%}
					<button type="submit" class="btn btn-danger btn-sm">永久删除</button>
					{%/if%}
				{%if $type=="inbox"%}
                  <button type="submit" class="btn btn-danger btn-sm">删除到垃圾箱</button>
				  {%/if%}
                </div>


               {%$page%}
                
                <!-- /.pull-right -->
              </div>
            </div>
			 </form>
          </div>
          <!-- /. box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
{%include file="index.footer.tpl.php"%}

<script src="static/js/icheck.min.js"></script><!--邮箱-->
<!-- Page Script -->
<script>
  $(function () {
    $('.mailbox-messages input[type="checkbox"]').iCheck({
      checkboxClass: 'icheckbox_flat-blue',
      radioClass: 'iradio_flat-blue'
    });
    $(".checkbox-toggle").click(function () {
      var clicks = $(this).data('clicks');
      if (clicks) {
        //Uncheck all checkboxes
        $(".mailbox-messages input[type='checkbox']").iCheck("uncheck");
        $(".fa", this).removeClass("fa-check-square-o").addClass('fa-square-o');
      } else {
        //Check all checkboxes
        $(".mailbox-messages input[type='checkbox']").iCheck("check");
        $(".fa", this).removeClass("fa-square-o").addClass('fa-check-square-o');
      }
      $(this).data("clicks", !clicks);
    });
    $(".mailbox-star").click(function (e) {
      e.preventDefault();
      //detect type
      var $this = $(this).find("a > i");
      var glyph = $this.hasClass("glyphicon");
      var fa = $this.hasClass("fa");

      //Switch states
      if (glyph) {
        $this.toggleClass("glyphicon-star");
        $this.toggleClass("glyphicon-star-empty");
      }

      if (fa) {
        $this.toggleClass("fa-star");
        $this.toggleClass("fa-star-o");
      }
    });
  });
</script>
